<template>
  <div>
    <dir class="box">
      <div class="title">
        <span class="jd">京东秒杀</span>
        <div class="red">
          <span class="time">{{ stime }}点场</span>
          <span class="countdown">
            <van-count-down :time="time" auto-start />
          </span>
        </div>
      </div>
      <div class="big">
        <div class="content" v-for="item in list" :key="item.id">
          <div class="bgimg">
            <img :src="item.icon" alt="" />
          </div>
          <p class="pri">￥{{ item.price }}</p>
          <p class="oldpri">￥{{ item.oldPrice }}</p>
        </div>
      </div>
    </dir>
  </div>
</template>

<script>
import { getSeconds } from "@/api/seconds";
import token from "@/utils/token";
export default {
  data() {
    return {
      stime: 16,
      time: 4 * 60 * 60 * 1000,
      list: [],
    };
  },
  async created() {
    try {
      let res = await getSeconds(token);
      // console.log(res);
      this.list = res.data.data.list;
    } catch (error) {
      console.log(error);
    }
  },
};
</script>

<style scoped lang="less">
.box {
  background-color: #fff;
  border-radius: 10px;
  margin: 10px;
  height: 170px;
  position: relative;
  left: 0;
  top: 187px;
  overflow: hidden;
  .title {
    height: 22px;
    line-height: 22px;
    display: flex;
    margin: 10px;

    // position: absolute;
    // left: 10px;
    // top: 10px;
    // background-color: aqua;
    .jd {
      font-size: 18px;
      margin-left: 10px;
    }
    .red {
      height: 22px;
      line-height: 22px;
      width: 135px;
      margin-left: 10px;
      border: 1px solid #d81e06;
      border-radius: 5px;
      .time {
        width: 50%;
        font-size: 16px;
        background-color: #d81e06;
        display: inline-block;
        color: #fff;
        overflow: hidden;
        text-align: center;
      }
      .countdown {
        display: inline-block;
        width: 50%;
        font-size: 16px;
        background-color: #fff;
        overflow: hidden;
      }
    }
  }
  .big {
    overflow: hidden;
    display: flex;
    overflow-x: scroll;
    .content {
      padding: 0 14px;
      text-align: center;
      display: inline-block;
      .bgimg {
        width: 74px;
        height: 74px;
        display: inline-block;
        img {
          width: 100%;
        }
      }
      .pri {
        font-size: 18px;
        color: #d81e06;
      }
      .oldpri {
        font-size: 16px;
        color: #999;
        text-decoration: line-through;
      }
    }
  }
}
/deep/ .van-count-down {
  font-size: 16px;
  line-height: 22px;
  color: #d81e06;
}
</style>
